package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the DEMAND database table.
 * 
 */
@Entity
@NamedQuery(name="Demand.findAll", query="SELECT d FROM Demand d")
public class Demand implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="DEMAND_DEMANDID_GENERATOR", sequenceName="SEQ_20")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DEMAND_DEMANDID_GENERATOR")
	@Column(name="DEMAND_ID")
	private long demandId;

	@Column(name="CUSTOMER_CHANCE")
	private BigDecimal customerChance;

	@Temporal(TemporalType.DATE)
	@Column(name="CUSTOMER_DATE")
	private Date customerDate;

	@Column(name="CUSTOMER_ID")
	private BigDecimal customerId;

	@Column(name="CUSTOMER_NAME")
	private String customerName;

	@Column(name="CUSTOMER_NR")
	private String customerNr;

	@Column(name="CUSTOMER_ZYCD")
	private String customerZycd;

	@Column(name="DEMAND_NAME")
	private String demandName;

	@Column(name="DEMAND_THEME")
	private String demandTheme;

	//bi-directional many-to-one association to Opportunity
	@OneToMany(mappedBy="demand")
	private List<Opportunity> opportunities;

	public Demand() {
	}

	public long getDemandId() {
		return this.demandId;
	}

	public void setDemandId(long demandId) {
		this.demandId = demandId;
	}

	public BigDecimal getCustomerChance() {
		return this.customerChance;
	}

	public void setCustomerChance(BigDecimal customerChance) {
		this.customerChance = customerChance;
	}

	public Date getCustomerDate() {
		return this.customerDate;
	}

	public void setCustomerDate(Date customerDate) {
		this.customerDate = customerDate;
	}

	public BigDecimal getCustomerId() {
		return this.customerId;
	}

	public void setCustomerId(BigDecimal customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return this.customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getCustomerNr() {
		return this.customerNr;
	}

	public void setCustomerNr(String customerNr) {
		this.customerNr = customerNr;
	}

	public String getCustomerZycd() {
		return this.customerZycd;
	}

	public void setCustomerZycd(String customerZycd) {
		this.customerZycd = customerZycd;
	}

	public String getDemandName() {
		return this.demandName;
	}

	public void setDemandName(String demandName) {
		this.demandName = demandName;
	}

	public String getDemandTheme() {
		return this.demandTheme;
	}

	public void setDemandTheme(String demandTheme) {
		this.demandTheme = demandTheme;
	}

	public List<Opportunity> getOpportunities() {
		return this.opportunities;
	}

	public void setOpportunities(List<Opportunity> opportunities) {
		this.opportunities = opportunities;
	}

	public Opportunity addOpportunity(Opportunity opportunity) {
		getOpportunities().add(opportunity);
		opportunity.setDemand(this);

		return opportunity;
	}

	public Opportunity removeOpportunity(Opportunity opportunity) {
		getOpportunities().remove(opportunity);
		opportunity.setDemand(null);

		return opportunity;
	}

}